#include<bits/stdc++.h>

using namespace std;

#define int long long 
typedef vector<int > ve;
const int inf = 0x3f3f3f3f;


signed main()
{
	int l, r; cin >> l >> r;  int cnt = 0;
	ve getday = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };   
	for (int i = 12; i >= 1; i--)
	{
		for (int j = getday[i]; j >= 1; j--)
		{
			int k = j % 10 * 1000 + j / 10 * 100 + i % 10 * 10 + i / 10;  
			int num = k * 10000 + i * 100 + j;
			if (num >= l && num <= r)cnt++;
		}
	}
		cout << cnt << endl; 
	return 0;
}

